home *** CD-ROM | disk | FTP | other *** search
/ Freelog 46 / Freelog046.iso / Alu / Celestia / Win32LoresTex / celestia-lores-win32-1.3.0.exe / {app} / shaders / diffuse_texoff.vp < prev    next >
Text File  |  2002-08-27  |  1KB  |  37 lines

  1. !!VP1.0
  2.  
  3. # Compute the diffuse light from a single source
  4.  
  5. # c[0]..c[3] contains the concatenation of the modelview and projection matrices.
  6. # c[4]..c[7] contains the inverse transpose of the modelview
  7. # c[15] contains the eye position in object space
  8. # c[16] contains the light direction in object space
  9. # c[17] contains H, the normalized sum of the eye and light direction
  10. # c[20] contains the light color * object color
  11. # c[32] contains the ambient light color * object color
  12. # c[33] contains the haze color
  13. # c[40] contains (0, 1, 0, specPower)
  14. # c[41] contains the texture offset
  15.  
  16. # Transform the vertex by the modelview matrix
  17. DP4   o[HPOS].x, c[0], v[OPOS];
  18. DP4   o[HPOS].y, c[1], v[OPOS];
  19. DP4   o[HPOS].z, c[2], v[OPOS];
  20. DP4   o[HPOS].w, c[3], v[OPOS];
  21.  
  22. # Compute the diffuse light component
  23. DP3   R2, v[NRML], c[16];
  24. # Clamp the diffuse component to zero
  25. MAX   R2, R2, c[40].xxxx;
  26. #ADD   R2, c[40].y, -R2;
  27. #MAD   R2, R2, -R2, c[40].y;
  28.  
  29. # Output the texture
  30. ADD   o[TEX0], v[TEX0], c[41];
  31. # Output the primary color
  32. MOV   R0, c[32];
  33. MAD   o[COL0], c[20], R2, R0;
  34.  
  35. END
  36.  
  37.